/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package slisfx.devices;

import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.RadioButton;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import slisfx.Globals;

/**
 *
 * @author ITC
 */
public class AlarmViewFX extends Application implements Globals  {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override
    public void start(Stage primaryStage) {
        primaryStage.setTitle("Alarm menu");
        primaryStage.setResizable(false);
        
        final ToggleGroup alarmStatus = new ToggleGroup();

        final RadioButton rb1 = new RadioButton("Alarm Off");
        rb1.setToggleGroup(alarmStatus);
        rb1.setSelected(true);

        final RadioButton rb2 = new RadioButton("Armed home");
        rb2.setToggleGroup(alarmStatus);

        final RadioButton rb3 = new RadioButton("Armed away");
        rb3.setToggleGroup(alarmStatus);
        
       
alarmStatus.selectedToggleProperty().addListener(new ChangeListener<Toggle>(){
    @Override
    public void changed(ObservableValue<? extends Toggle> ov,
        Toggle old_toggle, Toggle new_toggle) {
            if(rb1.isSelected()){
                System.out.println("Stand down!");
            }
            else if(rb2.isSelected()){
                System.out.println("I'll give you a warning when the bad guys come");
            }
            else if(rb3.isSelected()){
                System.out.println("No one is home, arm all systems!");
            }
            
    }});
           
        
        BorderPane mainWindow = new BorderPane();
        
        /* Here we can add images instead of Rectangle in the Future*/
        
        mainWindow.setTop(new Rectangle(830,50, Color.BLACK));
        mainWindow.setBottom(new Rectangle(830,50, Color.BLACK));
        mainWindow.setLeft(new Rectangle(50,350, Color.BLACK));
        mainWindow.setRight(new Rectangle(50, 350, Color.BLACK));
        
        
        HBox alarm = new HBox();
        alarm.setPadding(new Insets(10, 10, 10, 10));
        alarm.setSpacing(20);
        alarm.getChildren().add(rb1);
        alarm.getChildren().add(rb2);
        alarm.getChildren().add(rb3);
//        
//        HBox onOffBut = new HBox();
//        onOffBut.setPadding(new Insets(10, 10, 10, 10));
//        onOffBut.setSpacing(50);
//        onOffBut.getChildren().add(btn);
//        onOffBut.getChildren().add(btn2);
        
        
        VBox mainMenu = new VBox();
        mainMenu.setPadding(new Insets(10, 10, 10, 10));
        mainMenu.setSpacing(10);
        Text title = new Text("Alarm menu");
        title.setFont(Font.font("Amble CN", FontWeight.BOLD, 14));
        mainMenu.getChildren().add(title);
        mainMenu.getChildren().add(alarm);
//        mainMenu.getChildren().add(slider);
//        mainMenu.getChildren().add(onOffBut);
//        
        mainWindow.setStyle("-fx-background-color: #808080");
        mainWindow.setCenter(mainMenu);

        primaryStage.setScene(new Scene(mainWindow, WIDTH, HEIGHT));
        primaryStage.show();
    }
}
